package com.jerkin.thread;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * @version V1.0
 * @ClassName: AtmoicValue
 * @Description:
 * @author: huhongzhi
 * @date: 2020/10/10 17:17
 */
public class AtmoicValue {

    private static final ThreadLocal<String> THREAD_LOCAL_VALUE = new ThreadLocal<>();
    private static final InheritableThreadLocal<String> IN_THREAD_LOCAL_VALUE = new InheritableThreadLocal<>();
    private static final TransmittableThreadLocal<String> ttl = new TransmittableThreadLocal<>();

    public static void setValue(String value) {
        THREAD_LOCAL_VALUE.set(value);
    }

    public static String getValue() {
        return THREAD_LOCAL_VALUE.get();
    }

    public static void setInValue(String value) {
        IN_THREAD_LOCAL_VALUE.set(value);
    }

    public static String getInValue() {
        return IN_THREAD_LOCAL_VALUE.get();
    }

    public static void setTValue(String value) {
        ttl.set(value);
    }

    public static String getTValue() {
        return ttl.get();
    }
}
